package com.cryptoneedle.garden.repository.garden.ads;


import com.bubbles.engine.data.core.repository.BaseRepository;
import com.cryptoneedle.garden.entity.garden.ads.AdsTable;
import com.cryptoneedle.garden.key.TableKey;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>description: Ods-SourceTable </p>
 *
 * @author CryptoNeedle
 * @date 2025-09-25
 */
@Repository
public interface AdsTableRepository extends BaseRepository<AdsTable, TableKey> {

    @Query("FROM AdsTable ORDER BY catalogName, databaseName, tableName")
    List<AdsTable> adsTables();

    @Query("""
             FROM DorisTable
            WHERE catalogName = :catalogName
            ORDER BY catalogName, databaseName, tableName
            """)
    List<AdsTable> adsTables(String catalogName);

    @Query("""
             FROM DorisTable
            WHERE catalogName = :catalogName
              AND databaseName = :databaseName
            ORDER BY catalogName, databaseName, tableName
            """)
    List<AdsTable> adsTables(String catalogName, String databaseName);
}